package com.cjh.mybatis10.bulider;


import com.cjh.mybatis10.session.Configuration;
import com.cjh.mybatis10.type.TypeAliasRegistry;
import com.cjh.mybatis10.type.TypeHandlerRegistry;
import lombok.Getter;

/**
 * @Descripton 构建器的基类 建造者模式
 * @Author cjh
 * @Date 2023/5/26 11:08
 */

@Getter
public abstract class BaseBuilder {
    protected final Configuration configuration;
    protected final TypeAliasRegistry typeAliasRegistry;
    protected final TypeHandlerRegistry typeHandlerRegistry;

    public BaseBuilder(Configuration configuration) {
        this.configuration = configuration;
        this.typeAliasRegistry = this.configuration.getTypeAliasRegistry();
        this.typeHandlerRegistry = this.configuration.getTypeHandlerRegistry();
    }

    protected Class<?> resolveAlias(String alias){
        return typeAliasRegistry.resolveAlias(alias);
    }
}
